package com.example02;

import java.util.Scanner;

/**
 * @Auther: shiquan
 * @Date: 2024/10/14 - 10 - 14 -14:32
 */
public class Test001 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入机票的原价");
        int ticket  = sc.nextInt();
        System.out.println("请输入当前的月份");
        int month =sc.nextInt();
        System.out.println("请输入当前的仓位 0 头等舱  1 经济仓");
        int seat = sc.nextInt();

        //2 先判断月份是旺季还是淡季
        //旺季
        if (month >= 5 && month <= 10) {
            //进行判断当前机票是经济仓还是头等舱
            ticket = getPrice(ticket, seat, 0.9, 0.85);
            //淡季
        }else if ((month >=1 && month <= 4) ||(month >=11 && month <=12)) {
            ticket = getPrice((ticket), seat, 0.7, 0.65);
            } else {
                System.out.println("键盘输入的月份不合法");
            }
        System.out.println(ticket);
    }


    public static int getPrice(int ticket, int seat,double v0, double v1){
        if (seat == 0) {
            //头等舱
            ticket = (int) (ticket * v0);
        } else if (seat == 1) {
            //经济舱
            ticket = (int) (ticket * v1);
            //非法数据
        } else {
            System.out.println("没有这个仓位");
        }
        return ticket;

    }
}
